var clickerStorage = null;
function StageAssistant() {
}

StageAssistant.prototype.setup = function() {
	clickerStorage = new Mojo.Depot(
		{
			'name': "clicker",
			'version': 1,
			'replace': false
		},
		function() {
			clickerStorage.simpleGet('counter', function(response) {
				var size = Object.values(response).size();
				if(1 <= size) {
					this.getDirection(response);
				} else {
					this.controller.pushScene('clicker', 0, 'up');
				}
			}.bind(this));
		}.bind(this),
		function() {
			this.controller.pushScene('clicker', 0, 'up');
		}.bind(this)
	);
};

StageAssistant.prototype.getDirection = function(counter) {
	clickerStorage.simpleGet('direction', function(response) {
		var size = Object.values(response).size();
		if(1 <= size) {
			this.controller.pushScene('clicker', counter, response);
		} else {
			this.controller.pushScene('clicker', counter, 'up');
		}
	}.bind(this));
};